﻿using UnityEngine;
using QFramework;

namespace HKTools
{
    /// <summary>
    /// HK_FirstPersonCam 测试脚本
    /// </summary>
    public class Test_FirstPersonCam : HKFirstPersonCam_BaseController
    {
        void Awake()
        {
            this.RegisterEvent<Event_FPS_ChangePos>(args =>
            {
                HKDebug.Log("FirstPerson 切换位置：" + args._posType.ToString(), LogColor.Cyan, LogStyle.Bold);
            }).UnRegisterWhenGameObjectDestroyed(gameObject);

            this.RegisterEvent<Event_FPS_Trigger>(args =>
            {
                HKDebug.Log("FirstPerson 触发：" + args._triggerType.ToString(), LogColor.Cyan, LogStyle.Bold);
            }).UnRegisterWhenGameObjectDestroyed(gameObject);
        }

        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                this.SendCommand(new CMD_FPS_ChangePos(HK_FirstPersonPosEnum.Pos_01, true));
            }

            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                this.SendCommand(new CMD_FPS_ChangePos(HK_FirstPersonPosEnum.Pos_02, true));
            }

            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                this.SendCommand(new CMD_FPS_ChangePos(HK_FirstPersonPosEnum.Pos_03, true));
            }
        }
    }
}